<?php

/**
 * This controller handles error messages
 *
 * PHP version 5
 *
 * @category   Web
 * @package    Data2People
 * @subpackage Controllers
 * @author     Mike Bevz <mike.bevz@data2people>
 * @copyright  2007-2008 (c) Mike Bevz
 * @license    The BSD License http://data2people.com/license.txt
 * @version    SVN: $Id: ErrorController.php 13 2008-12-01 16:16:50Z michael.bevz $
 *
 */

/**
 * Includes
 */
require_once 'Zend/Controller/Action.php';
require_once 'Zend/Controller/Plugin/ErrorHandler.php';

/**
 * Error controller class
 *
 * PHP version 5
 *
 * @category   Web
 * @package    Data2People
 * @subpackage Controllers
 * @author     Mike Bevz <mike.bevz@data2people>
 * @copyright  2007-2008 (c) Mike Bevz
 * @license    The BSD License http://data2people.com/license.txt
 * @version    SVN: $Id: ErrorController.php 13 2008-12-01 16:16:50Z michael.bevz $
 *
 */

class ErrorController extends Zend_Controller_Action
{
    public  $errors;
    /**
     * Exceptions to be shown
     *
     * @var Exception
     */
    private $_exception;

    /**
     * Zend_Translate object
     *
     * @var Zend_Translate
     */
    private $_tr;

    /**
      * Default method
      *
      * @return void
      */
    public function errorAction()
    {


        $errors = $this->_getParam('error_handler');
        switch ($errors->type) {
        case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
        case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
            // 404 error -- controller or action not found
            //$this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
            $_exception = $errors->exception;
            break;
        default:
            // application error; display error page, but don't change
            // status code
            // ...
            // Log the exception:
            $_exception = $errors->exception;
            break;
        }
        $this->view->assign('errors',
            '"Tourstart Zend'." Error: "
            .$_exception->getMessage()."<br />"
            .'Code: '.$_exception->getCode().'<br />'
            .'File: '.$_exception->getFile()).'<br /><br />'
            .'Backtrace: '.$_exception->getTraceAsString();
    }
}
?>